# encoding: utf-8
def greet_user():
    """显示简单的问候语"""
    print("Hello!")
greet_user()



def greet_user(username):
    """显示简单的问候语"""
    print("Hello, " + username.title() + "!")
greet_user('lili')


def get_formatted_name(first_name, last_name, middle_name=''):
    """返回整洁的姓名"""
    #if middle_name:
    #    full_name = first_name + ' ' + middle_name + ' ' + last_name
    #else:
    #    full_name = first_name + ' ' + last_name
    full_name = first_name + ' ' + middle_name + ' ' + last_name
    return full_name.title()

musician = get_formatted_name('jimi', 'hendrix')
print(musician)

musician = get_formatted_name('john', 'hooker', 'lee')
print(musician)


def build_person(first_name, last_name, age=''):
    """返回一个字典， 其中包含有关一个人的信息"""
    person = {'first': first_name, 'last': last_name}
    if age:
        person['age'] = age
    return person
musician = build_person('lili', 'haha')
musician = build_person('lili', 'haha', '77')
print(musician)


def get_formatted_name(first_name, last_name):
    """返回整洁的姓名"""
    full_name = first_name + ' ' + last_name
    return full_name.title()

# 这是一个无限循环!
while True:
    print("\nPlease tell me your name:")
    print("(enter 'q' at any time to quit)")
    f_name = input("First name: ")
    if(f_name=='q'):
        break

    l_name = input("Last name: ")
    if(l_name=='q'):
        break

    formatted_name = get_formatted_name(f_name, l_name)
    print("\nHello, " + formatted_name + "!")